package com.http.test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsoup.Connection;
import org.jsoup.Connection.Method;
import org.jsoup.Connection.Response;
import org.jsoup.Jsoup;

import com.sun.prism.impl.TextureResourcePool;

public class Text {
	//API域名
    public final static String   url4 = "http://118.178.18.0:8082/alfa-mobile-ws/rest/order";
	public static void main(String[] args) {
		//请求
		String url="/findlist?mobiletoken=";
		//请求参数
		Map<String, String> bodyParam=new HashMap<String,String>();
		System.out.println(title("01a46d68065c40d0b13f3714af43fb4e", "filterscount=0&groupscount=0&pagenum=0&pagesize=10&recordstartindex=0&recordendindex=10&roleId=10&phone=18883753989&iphone=18883753989&orderid=61"));
	}
	public static String title(String mobiletoken, String jsonstr) {
		Connection conn = Jsoup.connect(url4+"/findlist?mobiletoken="+mobiletoken).timeout(0);
		
		List<String> list = new ArrayList<String>();
		//组装新json
		String newjson;
		List<String> img = new ArrayList<String>();
		Map<String, String> map = new HashMap<String, String>();
		map.put("filterscount", "0");
		map.put("groupscount", "0");
		map.put("pagenum", "0");
		map.put("pagesize", "10");
		map.put("recordstartindex", "0");
		map.put("recordendindex", "0");
		map.put("roleId", "10");
		map.put("phone", "18883753989");
		map.put("iphone", "18883753989");
		map.put("orderid", "61");
		conn.header("Accept", "application/json, text/javascript, */*; q=0.01");
		conn.header("Accept-Encoding", "gzip, deflate");
		conn.header("Accept-Language", "zh-CN,zh;q=0.8,en;q=0.6");
		conn.header("Cache-Control", "no-cache");
		conn.header("Connection", "Keep-Alive");
		conn.header("Content-Type", "application/json; charset=UTF-8");
		conn.header("User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; MALC)");
		try {
			Response response = conn.ignoreContentType(true).method(Method.POST).data(map).execute();
			System.out.println(response.body());
			list.add(response.body());
			return response.body();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;

	}

}
